package com.example.administrator.newproject;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class StartActivity extends ActionBarActivity {
    int count;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        final Handler handler=new Handler() ;
        new Thread(){


            @Override
            public void run() {
                super.run();


                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        SharedPreferences sharedPreferences=getSharedPreferences("AppGuide", Context.MODE_PRIVATE);
                        count = sharedPreferences.getInt("count", count);
                        if(count==0){
                            count++;
                            Intent intent=new Intent(StartActivity.this,WelcomeActivity.class);
                            startActivity(intent);
                            SharedPreferences sharedPreferences1=getSharedPreferences("AppGuide",Context.MODE_PRIVATE);
                            sharedPreferences1.edit().putInt("count",count).commit();


                        }else  {
                            count=1;//没有引导界面
                            Intent intent=new Intent(StartActivity.this,BeforeMainActivity.class);
                            startActivity(intent);
                        }

                    }
                });

            }
        }.start();


    }



}
